package cn.twh.wall.beetl.function;

import org.beetl.core.Context;
import org.beetl.core.Function;

import cn.twh.wall.util.SnowFlake;
import cn.twh.wall.util.SpringUtil;
/**
 * 流水生成并保存某些数据的方法
 * @author TWH
 */
public class SeqGenAndSaveDataFunction implements Function{
	private SnowFlake snowFlake = SpringUtil.getBean(SnowFlake.class);
	@Override
	public Object call(Object[] paras, Context ctx) {
		long seq = snowFlake.nextId();
		Cache.addSeqDataCache(String.valueOf(seq), paras[0]);
		return seq;
	}
}
